package com.hzc.springchan.strategy.requestlog;

import org.aspectj.lang.JoinPoint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 请求参数打印策略驱动环境类
 * @author chen990627
 * @date 2022/10/18
 */
@Component
public class RequestLogContext {

    @Autowired
    private Map<String, IRequestLogStrategy> container;

    public void requestLog(String strategyName, JoinPoint joinPoint) {

        IRequestLogStrategy strategy = container.get(strategyName);
        if (strategy == null) {
            // todo
            return;
        }
        strategy.requestLog(joinPoint);
    }
}
